<template>
  <Navheader></Navheader>
  <div class="main-container">
    <div class="hero-section">
      <el-carousel height="500px" indicator-position="outside" :interval="5000">
        <el-carousel-item v-for="item in carouselItems" :key="item.id">
          <div class="carousel-content"
            :style="{ backgroundImage: `linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(${item.image})` }">
            <h2>{{ item.title }}</h2>
            <p>{{ item.description }}</p>
          </div>
        </el-carousel-item>
      </el-carousel>
    </div>
    <div class="wave-container">
      <svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
        viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
        <defs>
          <path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" />
        </defs>
        <g class="parallax">
          <use xlink:href="#gentle-wave" x="48" y="0" fill="rgba(255,255,255,0.7" />
          <use xlink:href="#gentle-wave" x="48" y="3" fill="rgba(255,255,255,0.5)" />
          <use xlink:href="#gentle-wave" x="48" y="5" fill="rgba(255,255,255,0.3)" />
          <use xlink:href="#gentle-wave" x="48" y="7" fill="#fff" />
        </g>
      </svg>
    </div>
    <!-- 使用 flex 布局实现居中 -->
    <div class="scroll-indicator-container">
      <div class="scroll-indicator" @click="scrollDown">
        <ChevronDown class="bounce-arrow" />
        <ChevronDown class="bounce-arrow" />
      </div>
    </div>
    <div class="content-wrapper">
      <div class="content-left">
        <div class="info-box">
          <h2 class="section-title">什么是零浪费生活？</h2>
          <p>
            零浪费是一种生活方式和哲学，旨在最大限度地减少我们产生的废弃物。它鼓励重新设计生命周期，使所有产品都能被重复使用，从而不产生垃圾。
          </p>
          <p>
            <span class="bold">零浪费联盟2018年12月定义：</span><br>
            "零浪费是指通过负责任的生产、消费、重复使用，以及对产品、包装和材料进行回收来节约和保护所有资源，不焚烧、不排放威害环境和人类健康的物质到空气、水和土壤中。"
          </p>
          <p>简单来说，我们希望通过零浪费的生活方式，让所谓的「垃圾」不再进入垃圾填埋场、焚烧炉或海洋中。

            想要达到这样的目标，我们需要改变现有的生产-消费-丢弃的线性经济系统。

            在这样的经济系统中，「我们的工业文明就像一个马达，它输入大自然天然水体、矿藏和原始森林，输出垃圾。文明越发达，马达的功率越大，把大自然转化成垃圾的速度就越快」。

            零浪费的目标是转向循环经济，就像在自然界中一样。在自然中不存在垃圾,所有的一切通过生态系统连接在一起，完成自然循环和能量流动。而我们的垃圾像在系统中按下了暂停键。</p>
          <el-divider></el-divider>
          <p class="quote">「文明越发达，马达的功率越大，把大自然转化成垃圾的速度就越快」。</p>
        </div>
        <div class="info-box">
          <el-row :gutter="20">
            <el-col :span="8" v-for="(benefit, index) in zeroBenefits" :key="index">
              <div class="benefit-card">
                <el-icon :size="40" :color="benefit.color">
                  <component :is="benefit.icon" />
                </el-icon>
                <h3>{{ benefit.title }}</h3>
                <p>{{ benefit.description }}</p>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
      <div class="content-right">
        <h2 class="section-title">生活指南</h2>
        <el-timeline>
          <el-timeline-item v-for="(step, index) in zeroWasteSteps" :key="index" :icon="step.icon" :type="step.type">
            <h4>{{ step.title }}</h4>
            <p>{{ step.description }}</p>
          </el-timeline-item>
        </el-timeline>
      </div>
    </div>
    <footer class="site-footer">
      <div class="footer-content">
        <div class="footer-section">
          <h3>关于我们</h3>
          <p>创造一个更加可持续的未来</p>
        </div>
        <div class="footer-section">
          <h3>快速链接</h3>
          <ul>
            <li><a href="#">首页</a></li>
            <li><a href="#">关于零浪费</a></li>
            <li><a href="#">生活指南</a></li>
            <li><a href="#">联系我们</a></li>
          </ul>
        </div>
        <div class="footer-section">
          <h3>关注我们</h3>
          <div class="social-icons">
            <!-- 社交媒体图标可以在这里添加 -->
          </div>
        </div>
      </div>
      <div class="footer-bottom">
        <p>&copy; 2023 零浪费生活. 保留所有权利。</p>
      </div>
    </footer>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import Navheader from '../components/navHeader.vue';
import { ElCarousel, ElCarouselItem, ElDivider, ElButton, ElCollapse, ElCollapseItem, ElTimeline, ElTimelineItem, ElRow, ElCol } from 'element-plus';
import { Warning, ShoppingBag, Refresh, Delete, ShoppingCart, Brush, Money, Star } from '@element-plus/icons-vue';
import { ChevronDown } from 'lucide-vue-next';

const activeNames = ref([0]);

const carouselItems = [
  { id: 1, title: "拥抱零浪费生活", description: "为地球创造更美好的未来", image: "https://images.unsplash.com/photo-1542601906990-b4d3fb778b09?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80" },
  { id: 2, title: "减少塑料使用", description: "选择可重复使用的替代品", image: "https://images.unsplash.com/photo-1618477461853-cf6ed80faba5?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80" },
  { id: 3, title: "堆肥有机废弃物", description: "将厨余变为花园养分", image: "https://images.unsplash.com/photo-1416879595882-3373a0480b5b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80" },
];

const zeroWasteSteps = [
  { title: "减少使用一次性物品", description: "使用可重复使用的购物袋、水瓶和餐具。避免使用塑料吸管和一次性包装。", icon: ShoppingBag, type: "primary" },
  { title: "实践3R原则", description: "减少（Reduce）不必要的购买，重复使用（Reuse）物品，正确回收（Recycle）可回收物品。", icon: Refresh, type: "success" },
  { title: "堆肥厨余垃圾", description: "将厨余垃圾和园艺废弃物转化为肥料，减少垃圾填埋。", icon: Delete, type: "warning" },
  { title: "选择环保产品", description: "购买耐用、可修复、可回收或可降解的产品。支持使用环保包装的品牌。", icon: ShoppingCart, type: "info" },
  { title: "自制清洁用品", description: "使用简单的天然原料如醋、小苏打等制作清洁剂，减少化学品使用。", icon: Brush, type: "danger" },
];

const zeroBenefits = [
  { title: "环境保护", description: "减少垃圾填埋和污染，保护生态系统", icon: Warning, color: "#67C23A" },
  { title: "节省资源", description: "减少资源浪费，促进可持续发展", icon: Money, color: "#E6A23C" },
  { title: "提高生活质量", description: "简化生活，减少压力，提高幸福感", icon: Star, color: "#409EFF" },
];

const zeroWasteTips = [
  { title: "自带购物袋", content: "外出购物时随身携带可重复使用的购物袋，拒绝使用塑料袋。" },
  { title: "使用可重复使用的水瓶", content: "购买一个高质量的不锈钢或玻璃水瓶，减少一次性塑料瓶的使用。" },
  { title: "选择散装食品", content: "尽可能购买散装食品，减少包装waste。自带容器去购买谷物、坚果等。" },
  { title: "使用布质餐巾", content: "用布质餐巾代替纸巾，既环保又经济。" },
  { title: "堆肥", content: "开始堆肥，将厨余垃圾转化为肥料，用于家庭种植或园艺。" },
];

const startZeroWasteJourney = () => {
  console.log("Starting zero waste journey");
};

const scrollDown = () => {
  window.scrollTo({
    top: window.innerHeight,
    behavior: 'smooth'
  });
};
</script>

<style scoped lang="scss">
.main-container {
  width: 100%;
  margin-top: 60px;
  box-sizing: border-box;
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
  background-color: #f0f2f5;

  .hero-section {
    width: 100%;
    margin-bottom: 0;
    position: relative;

    .carousel-content {
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      color: white;
      background-size: cover;
      background-position: center;
      text-align: center;
      padding: 0 20px;
    }
  }

  .wave-container {
    position: relative;
    height: 15vh;
    bottom: 16vh;

    .waves {
      position: absolute;
      bottom: 0;
      width: 100%;
      height: 15vh;
      min-height: 100px;
      max-height: 150px;
    }
  }

  .scroll-indicator-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: -50px; // 调整箭头与波浪的距离
    z-index: 10;
  }

  .scroll-indicator {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: bounce 2s infinite;
  }

  .bounce-arrow {
    margin-top: -25px;
    width: 40px;
    height: 40px;
    color: white;
  }
}

.carousel-content h2 {
  font-size: 3em;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.carousel-content p {
  font-size: 1.5em;
  margin-bottom: 30px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.parallax>use {
  animation: move-forever 25s cubic-bezier(.55, .5, .45, .5) infinite;
}

.parallax>use:nth-child(1) {
  animation-delay: -2s;
  animation-duration: 7s;
}

.parallax>use:nth-child(2) {
  animation-delay: -3s;
  animation-duration: 10s;
}

.parallax>use:nth-child(3) {
  animation-delay: -4s;
  animation-duration: 13s;
}

.parallax>use:nth-child(4) {
  animation-delay: -5s;
  animation-duration: 20s;
}

@keyframes move-forever {
  0% {
    transform: translate3d(-90px, 0, 0);
  }

  100% {
    transform: translate3d(85px, 0, 0);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.content-wrapper {
  display: flex;
  justify-content: space-between;
  padding: 0 40px;
  margin-bottom: 60px;
}

.content-left,
.content-right {
  width: 48%;
}

.info-box,
.tips-box {
  border-radius: 12px;
  margin-bottom: 30px;
}

.section-title {
  margin-bottom: 20px;
  font-size: 1.8em;
}

.quote {
  font-style: italic;
  color: #606266;
  font-size: 1.1em;
  text-align: center;
  margin-top: 20px;
}

.tips-box h3 {
  margin-bottom: 20px;
  color: #67C23A;
}

.cta-section {
  background-color: #ecf5ff;
  text-align: center;
  padding: 60px 0;
  margin-top: 20px;
  border-radius: 12px;
}

.cta-section h2 {
  font-size: 2.5em;
  margin-bottom: 20px;
  color: #409EFF;
}

.cta-section p {
  font-size: 1.3em;
  margin-bottom: 40px;
  color: #606266;
}

.benefit-card {
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.benefit-card h3 {
  margin: 15px 0;
  color: #303133;
}

.benefit-card p {
  color: #606266;
  font-size: 0.9em;
}

@media (max-width: 768px) {
  .content-wrapper {
    flex-direction: column;
  }

  .content-left,
  .content-right {
    width: 100%;
  }

  .carousel-content h2 {
    font-size: 2em;
  }

  .carousel-content p {
    font-size: 1.2em;
  }

  .cta-section {
    margin: 0 20px 40px;
    padding: 60px 20px;
  }

  .wave-container {
    height: 10vh;
  }

  .waves {
    height: 40px;
    min-height: 40px;
  }
}

.site-footer {
  background-color: #333;
  color: #fff;
  padding: 60px 0 20px;
}

.footer-content {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-section {
  flex: 1;
  margin-bottom: 30px;
  min-width: 200px;
}

.footer-section h3 {
  color: #67C23A;
  margin-bottom: 20px;
  font-size: 1.2em;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 10px;
}

.footer-section ul li a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section ul li a:hover {
  color: #67C23A;
}

.social-icons {
  display: flex;
  gap: 15px;
}

.social-icons a {
  color: #fff;
  font-size: 1.5em;
  transition: color 0.3s ease;
}

.social-icons a:hover {
  color: #67C23A;
}

.footer-bottom {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #555;
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
  }

  .footer-section {
    margin-bottom: 30px;
  }
}
</style>